#size
res<-300
width<-500*res/72
height<-4/5*width

color<-c('gray80','gray45', 'gray15')
space<-c(0,2)#spaces between pairs of bars
border<-T
lwd_border<-0.5

#grid
lwd_grid<-0.5
color_grid<-"black"

#Data

LC3<-c(16.7, 55.6, 77.8, 72.2, 11.1)
LC5c<-c(22.2, 33.3, 44.4, 50, 0)
MP<-c(40, 30, 30, 20, 10) 


#Export to tiff
tiff(filename = "figures_tables/Fig2_LeftPanel_Act.tif",
     width = width, 
     height =height,
     res=res,
     units = "px", 
     pointsize=9,
     bg = "white", 
     type = 'cairo')

par(mar=c(4,6,3,4)+0.1,lwd=lwd_border)

barplot(rbind(LC3, LC5c, MP), width=0.2, xlim=c(0,4.5), ylim=c(0,100),beside=T,
        col=color,,space=c(0.5,0,0,0.5,0,0,0.5,0,0,0.5,0,0,0.5,0,0))
        
abline(h=seq(0,100,20),col=color_grid,lwd=lwd_grid)
abline(h=0)
abline(h=100)

mtext(c('Lobbying', 'Bureaucratic \n Help', 'Monitoring \n & Oversight', 'Community \n Mobilization', 'Other'),side=1,line=2,at=c(0.3,1.0,1.7,2.4,3.1)+0.1)

barplot(rbind(LC3, LC5c, MP), width=0.2, xlim=c(0,4.5), ylim=c(0,100),beside=T,
        col=color,lwd=lwd_border,space=c(0.5,0,0,0.5,0,0,0.5,0,0,0.5,0,0,0.5,0,0),
        ylab='Percentage of politicians providing type of project support',add=T)


legend(0.05,100,
       legend=c('LC3 chairperson','LC5 councillor', 'MP'),
       fill=c('gray80','gray45','gray15'),
       bty='n'
)

dev.off()